/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'central';
  @endpointMap = {
    cn-hangzhou = 'idaas-doraemon.cn-hangzhou.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('idaas-doraemon', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateAuthenticatorRegistrationRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='11122223333'),
  authenticatorType?: string(name='AuthenticatorType', description='This parameter is required.', example='webauthn'),
  clientExtendParamsJson?: string(name='ClientExtendParamsJson', example='由具体认证方式决定'),
  clientExtendParamsJsonSign?: string(name='ClientExtendParamsJsonSign', example='由具体认证方式决定'),
  registrationContext?: string(name='RegistrationContext', example='注册上下文'),
  serverExtendParamsJson?: string(name='ServerExtendParamsJson', example='由具体认证方式决定'),
  userDisplayName?: string(name='UserDisplayName', example='张三'),
  userId?: string(name='UserId', description='This parameter is required.', example='user-11122223333'),
  userName?: string(name='UserName', example='ZhangSan'),
}

model CreateAuthenticatorRegistrationResponseBody = {
  challengeBase64?: string(name='ChallengeBase64'),
  options?: string(name='Options'),
  requestId?: string(name='RequestId', example='DA0A9BF3-029D-5968-B876-0DF49777B22D'),
}

model CreateAuthenticatorRegistrationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAuthenticatorRegistrationResponseBody(name='body'),
}

/**
 * @summary 创建认证器请求
 *
 * @param request CreateAuthenticatorRegistrationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAuthenticatorRegistrationResponse
 */
async function createAuthenticatorRegistrationWithOptions(request: CreateAuthenticatorRegistrationRequest, runtime: Util.RuntimeOptions): CreateAuthenticatorRegistrationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.authenticatorType)) {
    query['AuthenticatorType'] = request.authenticatorType;
  }
  if (!Util.isUnset(request.clientExtendParamsJson)) {
    query['ClientExtendParamsJson'] = request.clientExtendParamsJson;
  }
  if (!Util.isUnset(request.clientExtendParamsJsonSign)) {
    query['ClientExtendParamsJsonSign'] = request.clientExtendParamsJsonSign;
  }
  if (!Util.isUnset(request.registrationContext)) {
    query['RegistrationContext'] = request.registrationContext;
  }
  if (!Util.isUnset(request.serverExtendParamsJson)) {
    query['ServerExtendParamsJson'] = request.serverExtendParamsJson;
  }
  if (!Util.isUnset(request.userDisplayName)) {
    query['UserDisplayName'] = request.userDisplayName;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userName)) {
    query['UserName'] = request.userName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAuthenticatorRegistration',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建认证器请求
 *
 * @param request CreateAuthenticatorRegistrationRequest
 * @return CreateAuthenticatorRegistrationResponse
 */
async function createAuthenticatorRegistration(request: CreateAuthenticatorRegistrationRequest): CreateAuthenticatorRegistrationResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAuthenticatorRegistrationWithOptions(request, runtime);
}

model CreateUserAuthenticateOptionsRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='11122223333'),
  authenticatorType?: string(name='AuthenticatorType', description='This parameter is required.', example='webauthn'),
  bindHashBase64?: string(name='BindHashBase64', example='1111222'),
  clientExtendParamsJson?: string(name='ClientExtendParamsJson', example='由具体认证方式决定'),
  clientExtendParamsJsonSign?: string(name='ClientExtendParamsJsonSign', example='由具体认证方式决定'),
  serverExtendParamsJson?: string(name='ServerExtendParamsJson', example='由具体认证方式决定'),
  userId?: string(name='UserId', description='This parameter is required.', example='user-11122223333'),
}

model CreateUserAuthenticateOptionsResponseBody = {
  challengeBase64?: string(name='ChallengeBase64', example='2343246776'),
  options?: string(name='Options', example='{\\\\"subscribeEvent\\\\":false,\\\\"installAgent\\\\":false}'),
  requestId?: string(name='RequestId', example='D0F570B0-89CE-07F2-B41E-F97E089E13C6'),
}

model CreateUserAuthenticateOptionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateUserAuthenticateOptionsResponseBody(name='body'),
}

/**
 * @summary 创建用户认证请求
 *
 * @param request CreateUserAuthenticateOptionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateUserAuthenticateOptionsResponse
 */
async function createUserAuthenticateOptionsWithOptions(request: CreateUserAuthenticateOptionsRequest, runtime: Util.RuntimeOptions): CreateUserAuthenticateOptionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.authenticatorType)) {
    query['AuthenticatorType'] = request.authenticatorType;
  }
  if (!Util.isUnset(request.bindHashBase64)) {
    query['BindHashBase64'] = request.bindHashBase64;
  }
  if (!Util.isUnset(request.clientExtendParamsJson)) {
    query['ClientExtendParamsJson'] = request.clientExtendParamsJson;
  }
  if (!Util.isUnset(request.clientExtendParamsJsonSign)) {
    query['ClientExtendParamsJsonSign'] = request.clientExtendParamsJsonSign;
  }
  if (!Util.isUnset(request.serverExtendParamsJson)) {
    query['ServerExtendParamsJson'] = request.serverExtendParamsJson;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateUserAuthenticateOptions',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建用户认证请求
 *
 * @param request CreateUserAuthenticateOptionsRequest
 * @return CreateUserAuthenticateOptionsResponse
 */
async function createUserAuthenticateOptions(request: CreateUserAuthenticateOptionsRequest): CreateUserAuthenticateOptionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return createUserAuthenticateOptionsWithOptions(request, runtime);
}

model DeregisterAuthenticatorRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='11122223333'),
  authenticatorUuid?: string(name='AuthenticatorUuid', description='This parameter is required.', example='a00712a4e56196755059356c290793031xHdUrCPXUS'),
  userId?: string(name='UserId', description='This parameter is required.', example='user-11122223333'),
}

model DeregisterAuthenticatorResponseBody = {
  requestId?: string(name='RequestId', example='D0F570B0-89CE-07F2-B41E-F97E089E13C6'),
}

model DeregisterAuthenticatorResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeregisterAuthenticatorResponseBody(name='body'),
}

/**
 * @summary 删除认证器
 *
 * @param request DeregisterAuthenticatorRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeregisterAuthenticatorResponse
 */
async function deregisterAuthenticatorWithOptions(request: DeregisterAuthenticatorRequest, runtime: Util.RuntimeOptions): DeregisterAuthenticatorResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.authenticatorUuid)) {
    query['AuthenticatorUuid'] = request.authenticatorUuid;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeregisterAuthenticator',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除认证器
 *
 * @param request DeregisterAuthenticatorRequest
 * @return DeregisterAuthenticatorResponse
 */
async function deregisterAuthenticator(request: DeregisterAuthenticatorRequest): DeregisterAuthenticatorResponse {
  var runtime = new Util.RuntimeOptions{};
  return deregisterAuthenticatorWithOptions(request, runtime);
}

model FetchAccessTokenRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='secAuthApp'),
  mobileExtendParamsJson?: string(name='MobileExtendParamsJson', description='This parameter is required.', example='eyJhdHRhY2htZW50IjoicGxhdGZvcm0iLCJ1c2VyVmVyaWZpY2F0aW9uIjoicmVxdWlyZWQifQ=='),
  mobileExtendParamsJsonSign?: string(name='MobileExtendParamsJsonSign', description='This parameter is required.', example='a3984bc27776bb6f65f82276f75d6a12d56e1b41e98ed6975d852b14309b8a20'),
  serverExtendParamsJson?: string(name='ServerExtendParamsJson', example='eyJhdHRhY2htZW50IjoicGxhdGZvcm0iLCJ1c2VyVmVyaWZpY2F0aW9uIjoicmVxdWlyZWQifQ=='),
  userId?: string(name='UserId', example='6ba923abf6749536b7fd31c6a31360fboOFZQ8WbzmG'),
  XClientIp?: string(name='XClientIp', example='124.127.214.94'),
}

model FetchAccessTokenResponseBody = {
  code?: string(name='Code', example='Operation.Success'),
  data?: {
    accessToken?: string(name='Access_token', example='eyciOi...jV_PTsxgaNA'),
    expiresIn?: string(name='Expires_in', example='7200'),
    idToken?: string(name='Id_token', example='NiwiZW...wcmlzZUlk'),
    refreshToken?: string(name='Refresh_token', example='7200'),
    scope?: string(name='Scope', example='openid'),
    tokenType?: string(name='Token_type', example='Bearer'),
  }(name='Data'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', example='BD908DED-849D-5FDB-9C9B-52B1D3F9DC41'),
  success?: boolean(name='Success', example='True'),
}

model FetchAccessTokenResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: FetchAccessTokenResponseBody(name='body'),
}

/**
 * @summary 获取access_token
 *
 * @param request FetchAccessTokenRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return FetchAccessTokenResponse
 */
async function fetchAccessTokenWithOptions(request: FetchAccessTokenRequest, runtime: Util.RuntimeOptions): FetchAccessTokenResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.mobileExtendParamsJson)) {
    query['MobileExtendParamsJson'] = request.mobileExtendParamsJson;
  }
  if (!Util.isUnset(request.mobileExtendParamsJsonSign)) {
    query['MobileExtendParamsJsonSign'] = request.mobileExtendParamsJsonSign;
  }
  if (!Util.isUnset(request.serverExtendParamsJson)) {
    query['ServerExtendParamsJson'] = request.serverExtendParamsJson;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.XClientIp)) {
    query['XClientIp'] = request.XClientIp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'FetchAccessToken',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取access_token
 *
 * @param request FetchAccessTokenRequest
 * @return FetchAccessTokenResponse
 */
async function fetchAccessToken(request: FetchAccessTokenRequest): FetchAccessTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  return fetchAccessTokenWithOptions(request, runtime);
}

model GetAuthenticatorRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='11122223333'),
  authenticatorUuid?: string(name='AuthenticatorUuid', description='This parameter is required.', example='1331311'),
  userId?: string(name='UserId', description='This parameter is required.', example='1'),
}

model GetAuthenticatorResponseBody = {
  authenticator?: {
    authenticatorName?: string(name='AuthenticatorName', example='ceshi'),
    authenticatorUuid?: string(name='AuthenticatorUuid'),
    credentialId?: string(name='CredentialId', example='1313'),
    customAuthenticator?: string(name='CustomAuthenticator', example='123123'),
    lastVerifySourceIp?: string(name='LastVerifySourceIp', example='127.0.0.1'),
    lastVerifyTime?: long(name='LastVerifyTime', example='123123'),
    lastVerifyUserAgent?: string(name='LastVerifyUserAgent', example='123123'),
    registerSourceIp?: string(name='RegisterSourceIp', example='127.0.0.1'),
    registerTime?: long(name='RegisterTime', example='1231313123'),
    type?: string(name='Type', example='TOTP'),
  }(name='Authenticator'),
  requestId?: string(name='RequestId', example='123131312313'),
}

model GetAuthenticatorResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAuthenticatorResponseBody(name='body'),
}

/**
 * @summary 查询单个认证器
 *
 * @param request GetAuthenticatorRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAuthenticatorResponse
 */
async function getAuthenticatorWithOptions(request: GetAuthenticatorRequest, runtime: Util.RuntimeOptions): GetAuthenticatorResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.authenticatorUuid)) {
    query['AuthenticatorUuid'] = request.authenticatorUuid;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAuthenticator',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询单个认证器
 *
 * @param request GetAuthenticatorRequest
 * @return GetAuthenticatorResponse
 */
async function getAuthenticator(request: GetAuthenticatorRequest): GetAuthenticatorResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAuthenticatorWithOptions(request, runtime);
}

model ListAuthenticationLogsRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='webauth_demo'),
  authenticatorType?: string(name='AuthenticatorType', example='TOTP'),
  authenticatorUuid?: string(name='AuthenticatorUuid', example='0fcd5fce3fdc42052633a65eb242f10aZ8nzoQMpV3m'),
  credentialId?: string(name='CredentialId', example='scimcred-003o4e2wqxlaxjmjyz96'),
  fromTime?: long(name='FromTime', example='1640144294'),
  logTag?: string(name='LogTag', example='login'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='10'),
  toTime?: long(name='ToTime', example='1640144694'),
  userId?: string(name='UserId', example='10e8c224'),
}

model ListAuthenticationLogsResponseBody = {
  authenticationLogContent?: [ 
    {
      aliUid?: string(name='AliUid', example='1588301417442737'),
      applicationExternalId?: string(name='ApplicationExternalId', example='sms_auth'),
      applicationUuid?: string(name='ApplicationUuid', example='0b6ba5da7bd4cef233ae7b48b5e5dcc1yx9aipQp0hD'),
      authenticationAction?: string(name='AuthenticationAction', example='send'),
      authenticationTime?: long(name='AuthenticationTime', example='1647233491138'),
      authenticatorName?: string(name='AuthenticatorName', example='TOTP-DefaultName'),
      authenticatorType?: string(name='AuthenticatorType', example='TOTP'),
      authenticatorUuid?: string(name='AuthenticatorUuid', example='c810731ad3af06e45171395abf19cf9cb00E7i97PhE'),
      challengeBase64?: string(name='ChallengeBase64', example='3519'),
      credentialId?: string(name='CredentialId', example='scimcred-00w9gcvpwueg7geg1a87'),
      errorCode?: string(name='ErrorCode', example='200'),
      errorMessage?: string(name='ErrorMessage', example='Request was denied due to business check permission'),
      logParams?: string(name='LogParams', example='khj'),
      logTag?: string(name='LogTag', example='login'),
      rawAuthenticationContext?: string(name='RawAuthenticationContext', example='{"name":"lili"}'),
      tenantId?: string(name='TenantId', example='8cefc5fe5d10dffffdcff011a6b34a863hHmgm0SIrh'),
      userAgent?: string(name='UserAgent', example='aoxis'),
      userId?: string(name='UserId', example='xhtseqml'),
      userSourceIp?: string(name='UserSourceIp', example='10.23.11.56'),
      verifyResult?: boolean(name='VerifyResult', example='true'),
    }
  ](name='AuthenticationLogContent'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='F620E712-F325-520D-BE1A-E2421B062F57'),
  totalCount?: long(name='TotalCount', example='3'),
}

model ListAuthenticationLogsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAuthenticationLogsResponseBody(name='body'),
}

/**
 * @summary 列表查询认证事件日志
 *
 * @param request ListAuthenticationLogsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAuthenticationLogsResponse
 */
async function listAuthenticationLogsWithOptions(request: ListAuthenticationLogsRequest, runtime: Util.RuntimeOptions): ListAuthenticationLogsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.authenticatorType)) {
    query['AuthenticatorType'] = request.authenticatorType;
  }
  if (!Util.isUnset(request.authenticatorUuid)) {
    query['AuthenticatorUuid'] = request.authenticatorUuid;
  }
  if (!Util.isUnset(request.credentialId)) {
    query['CredentialId'] = request.credentialId;
  }
  if (!Util.isUnset(request.fromTime)) {
    query['FromTime'] = request.fromTime;
  }
  if (!Util.isUnset(request.logTag)) {
    query['LogTag'] = request.logTag;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.toTime)) {
    query['ToTime'] = request.toTime;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAuthenticationLogs',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 列表查询认证事件日志
 *
 * @param request ListAuthenticationLogsRequest
 * @return ListAuthenticationLogsResponse
 */
async function listAuthenticationLogs(request: ListAuthenticationLogsRequest): ListAuthenticationLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAuthenticationLogsWithOptions(request, runtime);
}

model ListAuthenticatorOpsLogsRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='webauth_demo'),
  authenticatorType?: string(name='AuthenticatorType', example='webauthn'),
  authenticatorUuid?: string(name='AuthenticatorUuid', example='c810731ad3af06e45171395abf19cf9cb00E7i97PhE'),
  fromTime?: long(name='FromTime', example='1647232996712'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='10'),
  toTime?: long(name='ToTime', example='1647232996812'),
  userId?: string(name='UserId', example='wsnidfr'),
}

model ListAuthenticatorOpsLogsResponseBody = {
  authenticationLogContent?: [ 
    {
      aliUid?: string(name='AliUid', example='1218758215717204'),
      applicationExternalId?: string(name='ApplicationExternalId', example='webauth_demo'),
      applicationUuid?: string(name='ApplicationUuid', example='2bba0564edce2ff90c544dc623d1c1f5iPpCGAqTioA'),
      authenticatorName?: string(name='AuthenticatorName', example='TOTP-DefaultName'),
      authenticatorType?: string(name='AuthenticatorType', example='TOTP'),
      authenticatorUuid?: string(name='AuthenticatorUuid', example='0fcd5fce3fdc42052633a65eb242f10aZ8nzoQMpV3m'),
      challengeBase64?: string(name='ChallengeBase64', example='exfa'),
      credentialId?: string(name='CredentialId', example='scimcred-00t3zfhiy2ylzvm2i287'),
      errorCode?: string(name='ErrorCode', example='Failed'),
      errorMessage?: string(name='ErrorMessage', example='user not exist, alipayId=2088022534411015'),
      logParams?: string(name='LogParams', example='1'),
      operationAction?: string(name='OperationAction', example='ListTagResources'),
      operationResult?: boolean(name='OperationResult', example='True'),
      operationTime?: long(name='OperationTime', example='1647309893086'),
      rawContext?: string(name='RawContext'),
      tenantId?: string(name='TenantId', example='ed0222867189ad2bacfa746843d4b9692mlWC9sU3zl'),
      userAgent?: string(name='UserAgent', example='10.13.1.56'),
      userId?: string(name='UserId', example='3b323'),
      userSourceIp?: string(name='UserSourceIp', example='10.13.1.56'),
    }
  ](name='AuthenticationLogContent'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='39FF2C8B-73E7-5BA5-AC25-20EEAC37BAB0'),
  totalCount?: long(name='TotalCount', example='3'),
}

model ListAuthenticatorOpsLogsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAuthenticatorOpsLogsResponseBody(name='body'),
}

/**
 * @summary 列表查询认证器操作日志
 *
 * @param request ListAuthenticatorOpsLogsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAuthenticatorOpsLogsResponse
 */
async function listAuthenticatorOpsLogsWithOptions(request: ListAuthenticatorOpsLogsRequest, runtime: Util.RuntimeOptions): ListAuthenticatorOpsLogsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.authenticatorType)) {
    query['AuthenticatorType'] = request.authenticatorType;
  }
  if (!Util.isUnset(request.authenticatorUuid)) {
    query['AuthenticatorUuid'] = request.authenticatorUuid;
  }
  if (!Util.isUnset(request.fromTime)) {
    query['FromTime'] = request.fromTime;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.toTime)) {
    query['ToTime'] = request.toTime;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAuthenticatorOpsLogs',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 列表查询认证器操作日志
 *
 * @param request ListAuthenticatorOpsLogsRequest
 * @return ListAuthenticatorOpsLogsResponse
 */
async function listAuthenticatorOpsLogs(request: ListAuthenticatorOpsLogsRequest): ListAuthenticatorOpsLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAuthenticatorOpsLogsWithOptions(request, runtime);
}

model ListAuthenticatorsRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='11122223333'),
  authenticatorType?: string(name='AuthenticatorType', example='TOTP'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='5'),
  userId?: string(name='UserId', description='This parameter is required.', example='user-11122223333'),
}

model ListAuthenticatorsResponseBody = {
  authenticator?: [ 
    {
      applicationExternalId?: string(name='ApplicationExternalId', example='webauth_demo'),
      authenticatorName?: string(name='AuthenticatorName', example='TOTP-DefaultName'),
      authenticatorUuid?: string(name='AuthenticatorUuid', example='0fcd5fce3fdc42052633a65eb242f10aZ8nzoQMpV3m'),
      credentialId?: string(name='CredentialId', example='scimcred-00skzv5noh34r5aoci76'),
      lastVerifyTime?: long(name='LastVerifyTime', example='123123'),
      registerTime?: long(name='RegisterTime', example='1342800000000'),
      type?: string(name='Type', example='TOTP'),
    }
  ](name='Authenticator'),
  pageNumber?: long(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='5'),
  requestId?: string(name='RequestId', example='531FA210-6F3D-5368-9AE2-AD7B9D1D5CAA'),
  totalCount?: long(name='TotalCount', example='13'),
}

model ListAuthenticatorsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAuthenticatorsResponseBody(name='body'),
}

/**
 * @summary 列表查询认证器
 *
 * @param request ListAuthenticatorsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAuthenticatorsResponse
 */
async function listAuthenticatorsWithOptions(request: ListAuthenticatorsRequest, runtime: Util.RuntimeOptions): ListAuthenticatorsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.authenticatorType)) {
    query['AuthenticatorType'] = request.authenticatorType;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAuthenticators',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 列表查询认证器
 *
 * @param request ListAuthenticatorsRequest
 * @return ListAuthenticatorsResponse
 */
async function listAuthenticators(request: ListAuthenticatorsRequest): ListAuthenticatorsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAuthenticatorsWithOptions(request, runtime);
}

model ListCostUnitOrdersRequest {
  beginDate?: string(name='BeginDate', example='2021-11-16'),
  finalDate?: string(name='FinalDate', example='2021-12-04 00'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
}

model ListCostUnitOrdersResponseBody = {
  items?: [ 
    {
      aliOrderCode?: string(name='AliOrderCode', example='215222637610732'),
      aliOrderInstanceId?: string(name='AliOrderInstanceId', example='idaas_auth_public_cn-pl32pciy101'),
      createTime?: long(name='CreateTime', example='1646028448000'),
      exhausted?: boolean(name='Exhausted'),
      expiredTime?: long(name='ExpiredTime', example='1923321600000'),
      orderStatus?: string(name='OrderStatus', example='VALID'),
      refundTime?: long(name='RefundTime', example='1923321600000'),
      totalCostUnit?: long(name='TotalCostUnit', example='100000'),
      usedCostUnit?: long(name='UsedCostUnit', example='100'),
    }
  ](name='Items'),
  pageSize?: long(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='A82621A5-715C-5486-80E9-9262EE43BA55'),
  totalElements?: long(name='TotalElements', example='12'),
  totalPages?: long(name='TotalPages', example='2'),
}

model ListCostUnitOrdersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListCostUnitOrdersResponseBody(name='body'),
}

/**
 * @summary 查询按量计费订单列表
 *
 * @param request ListCostUnitOrdersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListCostUnitOrdersResponse
 */
async function listCostUnitOrdersWithOptions(request: ListCostUnitOrdersRequest, runtime: Util.RuntimeOptions): ListCostUnitOrdersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.beginDate)) {
    query['BeginDate'] = request.beginDate;
  }
  if (!Util.isUnset(request.finalDate)) {
    query['FinalDate'] = request.finalDate;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCostUnitOrders',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询按量计费订单列表
 *
 * @param request ListCostUnitOrdersRequest
 * @return ListCostUnitOrdersResponse
 */
async function listCostUnitOrders(request: ListCostUnitOrdersRequest): ListCostUnitOrdersResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCostUnitOrdersWithOptions(request, runtime);
}

model ListOrderConsumeStatisticRecordsRequest {
  aliOrderCode?: string(name='AliOrderCode', example='211283925690732'),
  applicationExternalId?: string(name='ApplicationExternalId'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  serviceCode?: string(name='ServiceCode'),
  statisticTimeMax?: string(name='StatisticTimeMax', example='2022-05-31'),
  statisticTimeMin?: string(name='StatisticTimeMin', example='2022-05-31'),
}

model ListOrderConsumeStatisticRecordsResponseBody = {
  items?: [ 
    {
      aliOrderCode?: string(name='AliOrderCode', example='23567876823'),
      applicationExternalId?: string(name='ApplicationExternalId', example='sms_auth'),
      chargedCount?: long(name='ChargedCount', example='1'),
      serviceCode?: string(name='ServiceCode', example='SMS'),
      statisticTime?: long(name='StatisticTime', example='1655388050'),
      totalPrice?: long(name='TotalPrice', example='10'),
      unitPrice?: long(name='UnitPrice', example='10'),
    }
  ](name='Items'),
  pageSize?: long(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='1655384783875'),
  totalElements?: long(name='TotalElements', example='100'),
  totalPages?: long(name='TotalPages', example='10'),
}

model ListOrderConsumeStatisticRecordsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListOrderConsumeStatisticRecordsResponseBody(name='body'),
}

/**
 * @summary 查询用量消费统计记录列表
 *
 * @param request ListOrderConsumeStatisticRecordsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListOrderConsumeStatisticRecordsResponse
 */
async function listOrderConsumeStatisticRecordsWithOptions(request: ListOrderConsumeStatisticRecordsRequest, runtime: Util.RuntimeOptions): ListOrderConsumeStatisticRecordsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.aliOrderCode)) {
    query['AliOrderCode'] = request.aliOrderCode;
  }
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.serviceCode)) {
    query['ServiceCode'] = request.serviceCode;
  }
  if (!Util.isUnset(request.statisticTimeMax)) {
    query['StatisticTimeMax'] = request.statisticTimeMax;
  }
  if (!Util.isUnset(request.statisticTimeMin)) {
    query['StatisticTimeMin'] = request.statisticTimeMin;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListOrderConsumeStatisticRecords',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询用量消费统计记录列表
 *
 * @param request ListOrderConsumeStatisticRecordsRequest
 * @return ListOrderConsumeStatisticRecordsResponse
 */
async function listOrderConsumeStatisticRecords(request: ListOrderConsumeStatisticRecordsRequest): ListOrderConsumeStatisticRecordsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listOrderConsumeStatisticRecordsWithOptions(request, runtime);
}

model ListPwnedPasswordsRequest {
  prefixHexPasswordSha1Hash?: string(name='PrefixHexPasswordSha1Hash', description='This parameter is required.', example='000000'),
}

model ListPwnedPasswordsResponseBody = {
  pageNumber?: long(name='PageNumber', example='2'),
  pageSize?: long(name='PageSize', example='10'),
  pwnedPasswordInfos?: [ 
    {
      hexPasswordSha1Hash?: string(name='HexPasswordSha1Hash', example='0000'),
      pwnedCount?: long(name='PwnedCount', example='84'),
    }
  ](name='PwnedPasswordInfos'),
  requestId?: string(name='RequestId', description='Id of the request', example='D0F570B0-89CE-07F2-B41E-F97E089E13C6'),
  totalCount?: long(name='TotalCount', example='80'),
}

model ListPwnedPasswordsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListPwnedPasswordsResponseBody(name='body'),
}

/**
 * @summary 弱密码检测
 *
 * @param request ListPwnedPasswordsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListPwnedPasswordsResponse
 */
async function listPwnedPasswordsWithOptions(request: ListPwnedPasswordsRequest, runtime: Util.RuntimeOptions): ListPwnedPasswordsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.prefixHexPasswordSha1Hash)) {
    query['PrefixHexPasswordSha1Hash'] = request.prefixHexPasswordSha1Hash;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPwnedPasswords',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 弱密码检测
 *
 * @param request ListPwnedPasswordsRequest
 * @return ListPwnedPasswordsResponse
 */
async function listPwnedPasswords(request: ListPwnedPasswordsRequest): ListPwnedPasswordsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPwnedPasswordsWithOptions(request, runtime);
}

model ListUsersRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='11122223333'),
  userId?: string(name='UserId', example='user-11122223333'),
}

model ListUsersResponseBody = {
  requestId?: string(name='RequestId', example='D0F570B0-89CE-07F2-B41E-F97E089E13C6'),
  totalCount?: long(name='TotalCount', example='13'),
  users?: [ 
    {
      userDisplayName?: string(name='UserDisplayName'),
      userId?: string(name='UserId', example='2323232676856745'),
      userName?: string(name='UserName', example='lili'),
    }
  ](name='Users'),
}

model ListUsersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListUsersResponseBody(name='body'),
}

/**
 * @summary 查询应用用户
 *
 * @param request ListUsersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListUsersResponse
 */
async function listUsersWithOptions(request: ListUsersRequest, runtime: Util.RuntimeOptions): ListUsersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListUsers',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询应用用户
 *
 * @param request ListUsersRequest
 * @return ListUsersResponse
 */
async function listUsers(request: ListUsersRequest): ListUsersResponse {
  var runtime = new Util.RuntimeOptions{};
  return listUsersWithOptions(request, runtime);
}

model QuerySmsReportsRequest {
  appId?: string(name='AppId', example='doraemon_xxxxx'),
  eventId?: string(name='EventId', example='eventId_xxxxxx'),
}

model QuerySmsReportsResponseBody = {
  requestId?: string(name='RequestId', example='4581B16-xxxxx'),
  smsReports?: [ 
    {
      appId?: string(name='AppId', example='appid'),
      chargedCount?: int32(name='ChargedCount'),
      code?: string(name='Code', example='0'),
      eventId?: string(name='EventId', example='event_xxxx'),
      mobile?: string(name='Mobile', example='156xxxxxxxx'),
      sn?: string(name='Sn', example='"d36xxxxx3573772f159f616ebJ8KGPBg7Hr::appId::123456::Bird"'),
      stat?: string(name='Stat', example='DELIVRD'),
      tenantId?: string(name='TenantId', example='d36a370f33f037233573772f15xxxxxx'),
      tid?: string(name='Tid', example='3514'),
      time?: string(name='Time', example='20220823171446'),
    }
  ](name='SmsReports'),
  totalElements?: long(name='TotalElements', example='15'),
}

model QuerySmsReportsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QuerySmsReportsResponseBody(name='body'),
}

/**
 * @summary 短信回执查询
 *
 * @param request QuerySmsReportsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QuerySmsReportsResponse
 */
async function querySmsReportsWithOptions(request: QuerySmsReportsRequest, runtime: Util.RuntimeOptions): QuerySmsReportsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QuerySmsReports',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 短信回执查询
 *
 * @param request QuerySmsReportsRequest
 * @return QuerySmsReportsResponse
 */
async function querySmsReports(request: QuerySmsReportsRequest): QuerySmsReportsResponse {
  var runtime = new Util.RuntimeOptions{};
  return querySmsReportsWithOptions(request, runtime);
}

model QuerySmsUpsResponseBody = {
  requestId?: string(name='RequestId'),
  smsUps?: [ 
    {
      content?: string(name='Content'),
      destCode?: string(name='DestCode'),
      phoneNumber?: string(name='PhoneNumber'),
      sendTime?: string(name='SendTime'),
      sequenceId?: string(name='SequenceId'),
      tenantId?: string(name='TenantId'),
    }
  ](name='SmsUps'),
  totalElements?: long(name='TotalElements'),
}

model QuerySmsUpsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QuerySmsUpsResponseBody(name='body'),
}

/**
 * @summary 短信上行查询
 *
 * @param request QuerySmsUpsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QuerySmsUpsResponse
 */
async function querySmsUpsWithOptions(runtime: Util.RuntimeOptions): QuerySmsUpsResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'QuerySmsUps',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 短信上行查询
 *
 * @return QuerySmsUpsResponse
 */
async function querySmsUps(): QuerySmsUpsResponse {
  var runtime = new Util.RuntimeOptions{};
  return querySmsUpsWithOptions(runtime);
}

model RegisterAuthenticatorRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='11122223333'),
  authenticatorName?: string(name='AuthenticatorName', example='ZhangSan\\\\"s authenticator'),
  authenticatorType?: string(name='AuthenticatorType', description='This parameter is required.', example='webauthn'),
  clientExtendParamsJson?: string(name='ClientExtendParamsJson', example='由具体认证方式决定'),
  clientExtendParamsJsonSign?: string(name='ClientExtendParamsJsonSign', example='由具体认证方式决定'),
  logParams?: string(name='LogParams', example='123123'),
  registrationContext?: string(name='RegistrationContext', description='This parameter is required.', example='{}'),
  requireChallengeBase64?: string(name='RequireChallengeBase64', example='AAAAdda'),
  serverExtendParamsJson?: string(name='ServerExtendParamsJson', example='由具体认证方式决定'),
  userId?: string(name='UserId', description='This parameter is required.', example='user-11122223333'),
  userSourceIp?: string(name='UserSourceIp', example='127.0.0.1'),
}

model RegisterAuthenticatorResponseBody = {
  authenticatorUuid?: string(name='AuthenticatorUuid', example='123123123'),
  etasResponseSting?: string(name='EtasResponseSting'),
  requestId?: string(name='RequestId', example='23123'),
}

model RegisterAuthenticatorResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RegisterAuthenticatorResponseBody(name='body'),
}

/**
 * @summary 注册认证器
 *
 * @param request RegisterAuthenticatorRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RegisterAuthenticatorResponse
 */
async function registerAuthenticatorWithOptions(request: RegisterAuthenticatorRequest, runtime: Util.RuntimeOptions): RegisterAuthenticatorResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.authenticatorName)) {
    query['AuthenticatorName'] = request.authenticatorName;
  }
  if (!Util.isUnset(request.authenticatorType)) {
    query['AuthenticatorType'] = request.authenticatorType;
  }
  if (!Util.isUnset(request.clientExtendParamsJson)) {
    query['ClientExtendParamsJson'] = request.clientExtendParamsJson;
  }
  if (!Util.isUnset(request.clientExtendParamsJsonSign)) {
    query['ClientExtendParamsJsonSign'] = request.clientExtendParamsJsonSign;
  }
  if (!Util.isUnset(request.logParams)) {
    query['LogParams'] = request.logParams;
  }
  if (!Util.isUnset(request.registrationContext)) {
    query['RegistrationContext'] = request.registrationContext;
  }
  if (!Util.isUnset(request.requireChallengeBase64)) {
    query['RequireChallengeBase64'] = request.requireChallengeBase64;
  }
  if (!Util.isUnset(request.serverExtendParamsJson)) {
    query['ServerExtendParamsJson'] = request.serverExtendParamsJson;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSourceIp)) {
    query['UserSourceIp'] = request.userSourceIp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RegisterAuthenticator',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 注册认证器
 *
 * @param request RegisterAuthenticatorRequest
 * @return RegisterAuthenticatorResponse
 */
async function registerAuthenticator(request: RegisterAuthenticatorRequest): RegisterAuthenticatorResponse {
  var runtime = new Util.RuntimeOptions{};
  return registerAuthenticatorWithOptions(request, runtime);
}

model ServiceInvokeRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='A0000003'),
  doraemonAction?: string(name='DoraemonAction', description='This parameter is required.', example='SimpleAuthInit'),
  mobileExtendParamsJson?: string(name='MobileExtendParamsJson', example='eyJhdHRhY2htZW50IjoicGxhdGZvcm0iLCJ1c2VyVmVyaWZpY2F0aW9uIjoicmVxdWlyZWQifQ=='),
  mobileExtendParamsJsonSign?: string(name='MobileExtendParamsJsonSign', example='ba6f5596f00102cb1a7d971f8390b7ccb28e6bc4e8694d051f9299ccc69e1186'),
  serverExtendParamsJson?: string(name='ServerExtendParamsJson', example='eyJhdHRhY2htZW50IjoicGxhdGZvcm0iLCJ1c2VyVmVyaWZpY2F0aW9uIjoicmVxdWlyZWQifQ=='),
  serviceCode?: string(name='ServiceCode', description='This parameter is required.', example='IFAA'),
  testModel?: boolean(name='TestModel', example='false'),
  XClientIp?: string(name='XClientIp', example='127.0.0.1'),
}

model ServiceInvokeResponseBody = {
  code?: string(name='Code', example='Operation.Success'),
  data?: string(name='Data', example='"{\\\\"ifaa\\\\"{\\\\"code\\\\":0,\\\\"message\\\\":\\\\"eyJo....BWUFBQUFBIn19\\\\"},\\\\"version\\\\":\\\\"1.0.0\\\\",\\\\"transaction\\\\":{\\\\"id\\\\":\\\\"sIFAA-ios\\\\",\\\\"type\\\\":\\\\"sIFAA-ios\\\\",\\\\"payload\\\\":\\\\"\\\\"},\\\\"action\\\\":\\\\"request/auth\\\\"}" }'),
  eventId?: string(name='EventId'),
  idToken?: string(name='IdToken', example='qacdfhigvbcvb'),
  message?: string(name='Message', example='Operation.Failure.ApiInvoke.ServiceInArrears'),
  requestId?: string(name='RequestId', example='F8F63CAB-A96C-5017-AFB0-324593223817'),
  success?: boolean(name='Success', example='true'),
}

model ServiceInvokeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ServiceInvokeResponseBody(name='body'),
}

/**
 * @summary 认证接口
 *
 * @param request ServiceInvokeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ServiceInvokeResponse
 */
async function serviceInvokeWithOptions(request: ServiceInvokeRequest, runtime: Util.RuntimeOptions): ServiceInvokeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.doraemonAction)) {
    query['DoraemonAction'] = request.doraemonAction;
  }
  if (!Util.isUnset(request.mobileExtendParamsJson)) {
    query['MobileExtendParamsJson'] = request.mobileExtendParamsJson;
  }
  if (!Util.isUnset(request.mobileExtendParamsJsonSign)) {
    query['MobileExtendParamsJsonSign'] = request.mobileExtendParamsJsonSign;
  }
  if (!Util.isUnset(request.serverExtendParamsJson)) {
    query['ServerExtendParamsJson'] = request.serverExtendParamsJson;
  }
  if (!Util.isUnset(request.serviceCode)) {
    query['ServiceCode'] = request.serviceCode;
  }
  if (!Util.isUnset(request.testModel)) {
    query['TestModel'] = request.testModel;
  }
  if (!Util.isUnset(request.XClientIp)) {
    query['XClientIp'] = request.XClientIp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ServiceInvoke',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 认证接口
 *
 * @param request ServiceInvokeRequest
 * @return ServiceInvokeResponse
 */
async function serviceInvoke(request: ServiceInvokeRequest): ServiceInvokeResponse {
  var runtime = new Util.RuntimeOptions{};
  return serviceInvokeWithOptions(request, runtime);
}

model UpdateAuthenticatorAttributeRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='11122223333'),
  authenticatorName?: string(name='AuthenticatorName', description='This parameter is required.', example='TOTP-DefaultName'),
  authenticatorUuid?: string(name='AuthenticatorUuid', description='This parameter is required.', example='c810731ad3af06e45171395abf19cf9cb00E7i97PhE'),
  userId?: string(name='UserId', description='This parameter is required.', example='user-11122223333'),
}

model UpdateAuthenticatorAttributeResponseBody = {
  requestId?: string(name='RequestId', example='D0F570B0-89CE-07F2-B41E-F97E089E13C6'),
}

model UpdateAuthenticatorAttributeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateAuthenticatorAttributeResponseBody(name='body'),
}

/**
 * @summary 更新认证器名字
 *
 * @param request UpdateAuthenticatorAttributeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateAuthenticatorAttributeResponse
 */
async function updateAuthenticatorAttributeWithOptions(request: UpdateAuthenticatorAttributeRequest, runtime: Util.RuntimeOptions): UpdateAuthenticatorAttributeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.authenticatorName)) {
    query['AuthenticatorName'] = request.authenticatorName;
  }
  if (!Util.isUnset(request.authenticatorUuid)) {
    query['AuthenticatorUuid'] = request.authenticatorUuid;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateAuthenticatorAttribute',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新认证器名字
 *
 * @param request UpdateAuthenticatorAttributeRequest
 * @return UpdateAuthenticatorAttributeResponse
 */
async function updateAuthenticatorAttribute(request: UpdateAuthenticatorAttributeRequest): UpdateAuthenticatorAttributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateAuthenticatorAttributeWithOptions(request, runtime);
}

model VerifyIdTokenRequest {
  applicationExternalId?: string(name='ApplicationExternalId', example='webauth_demo'),
  jwtIdToken?: string(name='JwtIdToken', description='jwtIdToken', example='eyJraWQiOiIzNj'),
}

model VerifyIdTokenResponseBody = {
  requestId?: string(name='RequestId', example='F620E712-F325-520D-BE1A-E2421B062F57'),
  userId?: string(name='UserId', example='123456'),
}

model VerifyIdTokenResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: VerifyIdTokenResponseBody(name='body'),
}

/**
 * @summary 验证id_token
 *
 * @param request VerifyIdTokenRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return VerifyIdTokenResponse
 */
async function verifyIdTokenWithOptions(request: VerifyIdTokenRequest, runtime: Util.RuntimeOptions): VerifyIdTokenResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.jwtIdToken)) {
    query['JwtIdToken'] = request.jwtIdToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'VerifyIdToken',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 验证id_token
 *
 * @param request VerifyIdTokenRequest
 * @return VerifyIdTokenResponse
 */
async function verifyIdToken(request: VerifyIdTokenRequest): VerifyIdTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  return verifyIdTokenWithOptions(request, runtime);
}

model VerifyUserAuthenticationRequest {
  applicationExternalId?: string(name='ApplicationExternalId', description='This parameter is required.', example='11122223333'),
  authenticationContext?: string(name='AuthenticationContext', description='This parameter is required.', example='{}'),
  authenticatorType?: string(name='AuthenticatorType', description='This parameter is required.', example='webauthn'),
  clientExtendParamsJson?: string(name='ClientExtendParamsJson', example='由具体认证方式决定'),
  clientExtendParamsJsonSign?: string(name='ClientExtendParamsJsonSign', example='由具体认证方式决定'),
  logParams?: string(name='LogParams', example='123123'),
  logTag?: string(name='LogTag', example='login'),
  requireBindHashBase64?: string(name='RequireBindHashBase64', example='AAAAdda'),
  requireChallengeBase64?: string(name='RequireChallengeBase64', example='AAAAdda'),
  serverExtendParamsJson?: string(name='ServerExtendParamsJson', example='由具体认证方式决定'),
  userId?: string(name='UserId', description='This parameter is required.', example='user-11122223333'),
  userSourceIp?: string(name='UserSourceIp', example='127.0.0.1'),
}

model VerifyUserAuthenticationResponseBody = {
  authenticateResultInfo?: {
    bindHashBase64?: string(name='BindHashBase64', example='10e8c224555bba8bfb780badebc4a08cc1Z6LmC6Hp9'),
    credentialId?: string(name='CredentialId', example='scimcred-000vfaknfwlp8kesl520'),
    userId?: string(name='UserId', example='3b32'),
  }(name='AuthenticateResultInfo'),
  etasSDKString?: string(name='EtasSDKString', example='zmtdjb'),
  idToken?: string(name='IdToken', example='qacdfhigvbcvb'),
  requestId?: string(name='RequestId', example='83ED3BC7-B36E-53B5-83D4-152CF2088DB9'),
  verifyResult?: boolean(name='VerifyResult', example='true'),
}

model VerifyUserAuthenticationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: VerifyUserAuthenticationResponseBody(name='body'),
}

/**
 * @summary 认证用户
 *
 * @param request VerifyUserAuthenticationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return VerifyUserAuthenticationResponse
 */
async function verifyUserAuthenticationWithOptions(request: VerifyUserAuthenticationRequest, runtime: Util.RuntimeOptions): VerifyUserAuthenticationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.applicationExternalId)) {
    query['ApplicationExternalId'] = request.applicationExternalId;
  }
  if (!Util.isUnset(request.authenticationContext)) {
    query['AuthenticationContext'] = request.authenticationContext;
  }
  if (!Util.isUnset(request.authenticatorType)) {
    query['AuthenticatorType'] = request.authenticatorType;
  }
  if (!Util.isUnset(request.clientExtendParamsJson)) {
    query['ClientExtendParamsJson'] = request.clientExtendParamsJson;
  }
  if (!Util.isUnset(request.clientExtendParamsJsonSign)) {
    query['ClientExtendParamsJsonSign'] = request.clientExtendParamsJsonSign;
  }
  if (!Util.isUnset(request.logParams)) {
    query['LogParams'] = request.logParams;
  }
  if (!Util.isUnset(request.logTag)) {
    query['LogTag'] = request.logTag;
  }
  if (!Util.isUnset(request.requireBindHashBase64)) {
    query['RequireBindHashBase64'] = request.requireBindHashBase64;
  }
  if (!Util.isUnset(request.requireChallengeBase64)) {
    query['RequireChallengeBase64'] = request.requireChallengeBase64;
  }
  if (!Util.isUnset(request.serverExtendParamsJson)) {
    query['ServerExtendParamsJson'] = request.serverExtendParamsJson;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userSourceIp)) {
    query['UserSourceIp'] = request.userSourceIp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'VerifyUserAuthentication',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 认证用户
 *
 * @param request VerifyUserAuthenticationRequest
 * @return VerifyUserAuthenticationResponse
 */
async function verifyUserAuthentication(request: VerifyUserAuthenticationRequest): VerifyUserAuthenticationResponse {
  var runtime = new Util.RuntimeOptions{};
  return verifyUserAuthenticationWithOptions(request, runtime);
}

